home *** CD-ROM | disk | FTP | other *** search
- -!PCKERM.ASM_PCKERM.ASM
- -1,1
- ; .XLIST
- -23,89
- IBMPC EQU 0 ; For IBM PC conditional assembly.
- Z100 EQU 1 ; For Heath/Zenith Z-100
- STEVE EQU 0 ; For Steve's homebrew assembly.
-
- ; System dependent parameters
-
- IF IBMPC
-
- DEFESC EQU ']'-100Q ; The default escape character.
-
- MDMDAT EQU 03F8H ; Address of modem port (data)
- MDMSTS EQU 03FDH ; Address of modem port status
- MDMCOM EQU 03FBH ; Address of modem port command
-
- MDMINP EQU 1 ; Input ready bit
-
- MDMINTV EQU 0030H ; Address of modem port interrupt vector
- MDMINTO EQU 0EFH ; Mask to enable interrupt for modem port
- MDMINTC EQU 010H ; Bit to set to disable interrupts for modem
- INTCONT EQU 0021H ; Address of 8259 interrupt controller ICW2-3
- INTCON1 EQU 0020H ; Address of 8259 ICW1
- EOICOM EQU 0064H ; End of interrupt
- -97
- ; Interrupt types for extra system functions
-
- BIOS EQU 10H
- COMM EQU 14H
- KEYB EQU 16H
- ENDIF
-
- IF Z100
-
- DEFESC EQU '\'-100Q ; The default escape character.
-
- ; BIOS entry points
-
- BIOS_SEG SEGMENT AT 40H ; Define segment where BIOS really is
-
- ORG 6*3
- BIOS_AUXOUT LABEL FAR ; AUX output routine
-
- ORG 26*3
- BIOS_AUXFUNC LABEL FAR ; AUX: function
-
- BIOS_SEG ENDS ; End of BIOS segment defs
-
- ; Function codes for BIOS_AUXFUNC
-
- CHR_READ EQU 1 ; Read character
- CHR_STATUS EQU 2 ; Get status
- CHR_SFGS EQU 0 ; Get status subfunction
- CHR_SFGC EQU 1 ; Get config subfunction
- CHR_CONTROL EQU 3 ; Control function
- CHR_CFSU EQU 0 ; Set new configuration parameters
-
-
- B00455 EQU 0 ; 45.5 baud
- B0050 EQU 1 ; 50 baud
- B0075 EQU 2 ; 75 baud
- B0110 EQU 3 ; 110 baud
- B01345 EQU 4 ; 134.5 baud
- B0150 EQU 5 ; 150 baud
- B0300 EQU 6 ; 300 baud
- B0600 EQU 7 ; 600 baud
- B1200 EQU 8 ; 1200 baud
- B1800 EQU 9 ; 1800 baud
- B2000 EQU 10 ; 2000 baud
- B2400 EQU 11 ; 2400 baud
- B4800 EQU 12 ; 4800 baud
- B9600 EQU 13 ; 9600 baud
- B19200 EQU 14 ; 19200 baud
- B38400 EQU 15 ; 38400 baud
- ENDIF
-
- BELL EQU 07Q
- TAB EQU 11Q
- LF EQU 12Q
- FF EQU 14Q
- CR EQU 15Q
- XON EQU 21Q
- XOFF EQU 23Q
- ESC EQU 33Q
- DEL EQU 177Q
- BS EQU 08H
-
- DOS EQU 21H
-
- CONIN EQU 01H
- CONOUT EQU 02H
- RDRIN EQU 03H
- PUNOUT EQU 04H
- LSTOUT EQU 05H
- DCONIO EQU 06H
- GTIOB EQU 07H
- PRSTR EQU 09H
- CONSTAT EQU 0BH
- OPENF EQU 0FH
- CLOSF EQU 10H
- SFIRST EQU 11H
- SNEXT EQU 12H
- DELF EQU 13H
- READF EQU 14H ; Read from the file.
- WRITEF EQU 15H
- MAKEF EQU 16H
- SETDMA EQU 1AH ; Set disk transfer address
- CFLSZ EQU 23H
-
- MAXPKT EQU '~'-' '+2Q ; Maximum size of a packet.
- MAXTRY EQU 05Q ; Default number of retries on a packet.
- IMXTRY EQU 20Q ; Default number of retries send initiate.
- DRPSIZ EQU 5EH ; Default receive packet size.
- DSPSIZ EQU 20H ; Default send packet size.
- DSTIME EQU 08H ; Default send time out interval.
- DRTIME EQU 05H ; Default receive time out interval.
- DSPAD EQU 00H ; Default send padding.
- DRPAD EQU 00H ; Default receive padding.
- DSPADC EQU 00H ; Default send padding char.
- DRPADC EQU 00H ; Default receive padding char.
- DSEOL EQU CR ; Default send EOL char.
- DREOL EQU CR ; Default receive EOL char.
- DSQUOT EQU '#' ; Default send quote char.
- DRQUOT EQU '#' ; Default receive quote char.
-
- SOH EQU 01H ; Start of header char.
-
- BUFSIZ EQU 80H ; Size of DMA.
- MAXFIL EQU 50H ; Maximum number of files allowed.
-
- DIASW EQU 01H ; Default is diagnostics on.
-
- CMKEY EQU 01H ; Parse a keyword.
- CMIFI EQU 02H ; Parse an input file spec (can be wild).
- CMOFI EQU 03H ; Parse an output file spec.
- CMCFM EQU 04H ; Parse a confirm.
-
- -107,107
- versio db 'CUCCA'
- IF IBMPC
- db ' IBM-PC'
- ENDIF
- IF Z100
- db '/Stevens Heath/Zenith Z-100'
- ENDIF
- db ' Kermit-86 - ver 1.0',cr,lf,
- -117,117
- db 'type Ctrl-'
- IF IBMPC
- db ']'
- ENDIF
- IF Z100
- db '\'
- ENDIF
- db '-C to return to PC]',cr,lf,'$'
- -118:tmsg2 db cr,lf,'[Back at micro]',cr,lf,'$'
- -164,164
- IF IBMPC
- db cr,lf,'VT52-EMULATION$'
- ENDIF
- IF Z100
- db '$'
- ENDIF
- -169,169
- IF IBMPC
- bdhlp db cr,lf,'300 1200 1800 4800$'
- ENDIF
- IF Z100
- bdhlp db cr,lf,'45.5 50 75 110 134.5 150 300'
- db ' 600 1200 1800'
- db cr,lf,' 2000 2400 4800 9600 19200 38400'
- ENDIF
- -177,184
- IF IBMPC
- vtemst db cr,lf,'VT52 emulation on$'
- novtst db cr,lf,'VT52 emulation off$'
- ENDIF
- ibmst db cr,lf,'IBM on$'
- noibm db cr,lf,'IBM off$'
- IF Z100
- b04st db cr,lf,'Baud rate is 45.5$'
- b05st db cr,lf,'Baud rate is 50$'
- b07st db cr,lf,'Baud rate is 75$'
- b11st db cr,lf,'Baud rate is 110$'
- b13st db cr,lf,'Baud rate is 134.5$'
- b15st db cr,lf,'Baud rate is 150$'
- ENDIF
- b03st db cr,lf,'Baud rate is 300$'
- IF Z100
- b06st db cr,lf,'Baud rate is 600$'
- ENDIF
- b12st db cr,lf,'Baud rate is 1200$'
- b18st db cr,lf,'Baud rate is 1800$'
- IF Z100
- b20st db cr,lf,'Baud rate is 2000$'
- b24st db cr,lf,'Baud rate is 2400$'
- ENDIF
- b48st db cr,lf,'Baud rate is 4800$'
- IF Z100
- b96st db cr,lf,'Baud rate is 9600$'
- b19st db cr,lf,'Baud rate is 19200$'
- b38st db cr,lf,'Baud rate is 38400$'
- ENDIF
- -191,191
- outlin db cr,lf,' CUCCA'
- IF IBMPC
- db ' IBM-PC'
- ENDIF
- IF Z100
- db '/Stevens Heath/Zenith Z-100'
- ENDIF
- db ' Kermit-86 V1.0',
- -199,200
- IF IBMPC
- clrlin db cr,'$' ; Clear line (just the cr part).
- ENDIF
- IF Z100
- clrlin db cr,esc,'K$' ; Clear line on Z-100
- clrscr db esc,'H',esc,'J$' ; Home and clear screen
- homcur db esc,'H$' ; Home cursor
- ENDIF
- prsp db ' $' ; Print a space.
-
- ; Cursor addressing items
-
- IF IBMPC
- -201:scrhi dw 0434H ; Err when 8th bit is on.
- -224
- ENDIF
-
- IF Z100
- scrhi db esc,'Y',23H,54H,lf,'$' ; 8th bit on in character
- scrrpr db esc,'Y',27H,20H,'$' ; Prompt when Kermit ends
- screrr db esc,'Y',26H,20H,'$' ; Error messages
- scrfln db esc,'Y',25H,2CH,'$' ; File name
- scrnrt db esc,'Y',23H,35H,lf,'$' ; Number of retries
- scrnp db esc,'Y',23H,35H,'$' ; Number of packets
- scrfr db esc,'Y',26H,20H,'$' ; Rename file
- scrst db esc,'Y',23H,54H,'$' ; Status
- scrsp db esc,'Y',28H,20H,'$' ; send packet
- scrrp db esc,'Y',2AH,20H,'$' ; Receive packet
- ENDIF
- -245,245
- IF IBMPC
- settab db 07H ; seven entries.
- ENDIF
- IF Z100
- settab db 06H ; Only six entries for Z-100
- ENDIF
- -258,259
- IF IBMPC
- db 0EH,'VT52-EMULATION$'
- dw vt52em
- ENDIF
- -272
- IF IBMPC
- -281
- ENDIF
- IF Z100
- bdtab db 010H ; 16 entries
- db 03H,'110$'
- dw b0110
- db 04H,'1200$'
- dw b1200
- db 03H,'134$'
- dw b01345
- db 03H,'150$'
- dw b0150
- db 04H,'1800$'
- dw b1800
- db 05H,'19200$'
- dw b19200
- db 04H,'2000$'
- dw b2000
- db 04H,'2400$'
- dw b2400
- db 03H,'300$'
- dw b0300
- db 05H,'38400$'
- db b38400
- db 02H,'45$'
- dw b00455
- db 04H,'4800$'
- dw b4800
- db 02H,'50$'
- dw b0050
- db 03H,'600$'
- dw b0600
- db 02H,'75$'
- dw b0075
- db 04H,'9600$'
- dw b9600
- ENDIF
- -282:
- -324,324
- IF IBMPC
- vtflg db 1 ; VT52 emulation flag (default on).
- ENDIF
- -339,339
- IF IBMPC
- baud db B4800 ; Use default of 4800.
- ENDIF
- IF Z100
- auxcnf db 4 dup(?) ; AUX port configuration info
- baud db ? ; Baud rate
- auxcnf1 db 12 dup(?) ; Rest of configuration info
- ENDIF
- -388,390
- -404
- call cmblnk ; Clear the screen.
- call locate
-
- -409,409
- mov ah,setdma ; Set disk transfer address.
- -410: mov dx,offset buff
- -413,413
- IF IBMPC
- mov dx,mdmcom ; LCR -- Initialize baud rate.
- -418,418
- mov dx,mdmdat
- -424,426
- mov dx,mdmcom
- mov al,bl
- out dx,al
- ENDIF
-
- IF Z100
- mov bx,ds ; Set up pointer to config info
- mov es,bx ; . . .
- mov bx,offset auxcnf ; . . .
- mov ah,chr_status ; Get the function code
- mov al,chr_sfgc ; And the subfunction to get config
- call bios_auxfunc ; Get the block
- ENDIF
- -486
- IF IBMPC
- -491
- ENDIF
-
- IF Z100
- mov dx,offset screrr ; Get address of string to position cursor
- mov ah,prstr ; Get the function code
- int dos ; Print the addressing string
- ret ; And return
- ENDIF
- -492:ERPOS ENDP
- -496
- IF IBMPC
- -501
- ENDIF
-
- IF Z100
- mov ah,prstr ; Get the function to print string
- mov dx,offset scrnrt ; Get the address of the string
- int dos ; Print the string
- ret ; And return
- ENDIF
- -507
- IF IBMPC
- -511
- ENDIF
-
- IF Z100
- mov ah,prstr ; Get the function to print string
- mov dx,offset scrhi ; Get the address of the string
- int dos ; Print the string
- ENDIF
- -618,618
- read2:
- IF IBMPC
- mov ah,2 ; Position cursor.
- -619: mov dx,scrst
- -621
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrst ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -624
- IF IBMPC
- -628
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrnp ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -645
- IF IBMPC
- -649
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrst ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -650: mov dx,offset infms3 ; Plus a little cuteness.
- -652
- IF IBMPC
- -657,658
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrrpr ; and string to move cursor
- int dos ; Print the string
- ENDIF
- jmp rskp
- read6:
- IF IBMPC
- mov ah,2 ; Position cursor.
- -661
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrst ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -664
- IF IBMPC
- -668
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrrpr ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -669: jmp rskp
- -1008,1008
- send2:
- IF IBMPC
- mov ah,2 ; Position cursor.
- -1011
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrst ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -1014
- IF IBMPC
- -1018
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrnp ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -1042
- IF IBMPC
- -1043: mov ah,2 ; Position cursor.
- -1046
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrst ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -1049
- IF IBMPC
- -1054,1055
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrrpr ; and string to move cursor
- int dos ; Print the string
- ENDIF
- jmp rskp
- send8:
- IF IBMPC
- mov ah,2 ; Position cursor.
- -1058
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrst ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -1061
- IF IBMPC
- -1062: mov ah,2
- -1065
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrrpr ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -1180
- IF IBMPC
- -1184
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrfln ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -1744
- IF IBMPC
- -1748
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrfln ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -1749: mov ah,prstr ; Print the file name.
- -1762,1762
- gf8x:
- IF IBMPC
- mov ah,2 ; Position cursor.
- -1765
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrfr ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -1921
- IF IBMPC
- -1925
- ENDIF
- IF Z100
- mov ah,prstr ; Get print string function
- mov dx,offset scrsp ; and string to move cursor
- int dos ; Print the string
- ENDIF
- -1959
- IF IBMPC
- -1960:outchr: mov al,ah ; Char must be in al.
- -1971
- ENDIF
-
- IF Z100
- outchr: mov al,ah ; Yes, get the character into al
- mov cx,0
- cmp ibmflg,0 ; IBM mode?
- je outch1 ; No, skip this
- or al,080H ; Yes, turn on parity bit
- outch1: call bios_auxout ; Send the character
- ENDIF
-
- -1986,1989
- inchr:
- IF IBMPC
- mov dx,mdmsts ; Get port status.
- in al,dx
- test al,mdminp ; Data available?
- jnz inchr3 ; Read char ok.
- ENDIF
- IF Z100
- push bx ; Save BX
- mov ah,chr_status ; Get the function
- mov al,chr_sfgs ; And the subfunction
- call bios_auxfunc ; Determine if anything to input
- cmp bl,0 ; Is there?
- jnz inchr3 ; Yes, go get it
- pop bx ; And restore BX
- ENDIF
- -2001,2002
-
- inchr3:
- IF IBMPC
- mov dx,mdmdat ; Read in the char.
- in al,dx
- ENDIF
- IF Z100
- mov ah,chr_read ; Get the function to read
- call bios_auxfunc ; Get a character
- pop bx ; Restore BX
- ENDIF
- -2016
- IF IBMPC
- -2020
- ENDIF
-
- IF Z100
- mov ah,prstr ; Get the function to print string
- mov dx,offset scrst ; Get the string address
- int dos ; Position the cursor
- ENDIF
- -2021: mov ah,prstr
- -2174,2174
- IF IBMPC
- -2178
- ENDIF
- -2192
- IF IBMPC
- -2197,2199
- mov bx,mdmintv
- push [bx] ; Serial Card Interrupt vector.
- mov bx,mdmintv+2
- -2205,2205
- mov bx,mdmintv
- -2206: mov ax,offset serint
- -2209,2209
- mov bx,mdmintv+2
- -2227,2230
- in al,intcont ; Set up 8259 interrupt controller.
- and al,MDMINTO ; Enable INT4.
- out intcont,al
- mov dx,mdmcom ; Set up baud, parity, etc.
- -2242,2242
- ENDIF
- IF Z100
- mov ssp,sp ; Save current stack pointer
- ENDIF
- telnoe: call plup ; Char at port (type to console) ?
- IF IBMPC
- -2245
- ENDIF
- -2253
- IF IBMPC
- -2254: cmp al,BELL
- -2261
- ENDIF
- IF Z100
- mov dl,al ; Get the character
- mov ah,dconio ; and the function
- int dos ; type the character
- jmp telnoe ; Get next character
- ENDIF
- -2265
- IF IBMPC
- -2271,2273
- in al,intcont ; Interrupt control.
- or al,mdmintc ; Inhibit IRQ4.
- out intcont,al
- -2283,2285
- mov bx,mdmintv+2 ; Restore old interrupt vectors.
- pop [bx]
- mov bx,mdmintv
- -2289
- ENDIF
- IF Z100
- mov sp,ssp
- ENDIF
- -2290: mov ah,prstr
- -2296
- IF IBMPC
- -2307,2311
- mov dx,mdmsts ; Asynch status port.
- in al,dx
- test al,mdminp ; Data available?
- jz retint ; Nope.
- mov dx,mdmdat
- -2325,2326
- mov al,eoicom
- out intcon1,al ;Send End-of-Interrupt to 8259.
- -2332
- ENDIF
- -2340
- nop ; Make sure we have 3 bytes
- -2341: jmp plup
- -2348
- IF IBMPC
- -2365
- ENDIF
- IF Z100
- push bx ; Save BX
- mov ah,chr_status ; Get the function we want
- mov al,chr_sfgs ; Get the subfunction to get status
- call bios_auxfunc ; Perform the function
- cmp bl,0 ; Anything in queue?
- jne prtch1 ; Yes, go get it
- pop bx ; Restore BX
- jmp rskp ; No, give skip return
-
- prtch1: mov ah,chr_read ; Want to read character
- call bios_auxfunc ; Do it
- and al,07FH ; Strip off parity bit
- pop bx ; And restore BX
- ENDIF
- -2369
- IF IBMPC
- -2392,2393
- ENDIF
-
- CONCHR PROC NEAR
- IF IBMPC
- -2414
- ENDIF
- IF Z100
- mov ah,dconio ; Determine if character present
- mov dl,0ffH ; Want input
- int dos ; Get status
- cmp al,00H ; Any characters there?
- jne nobrk ; if not, forget it
- jmp rskp ; Give skip return
- ENDIF
- -2415:
- -2434
- IF IBMPC
- -2438
- ENDIF
- -2489,2490
- IF IBMPC
- mov dx,mdmdat
- out dx,al
- ENDIF
- IF Z100
- call bios_auxout ; Send the character
- ENDIF
- -2495
- IF IBMPC
- -2525
- ENDIF
- -2526: jmp telnoe ; Return home.
- -2528
- IF IBMPC
- -2657
- ENDIF
- -2733
- IF IBMPC
- -2747
- ENDIF
- -2813
- IF IBMPC
- -2814: mov dx,03FBH ; LCR
- -2827
- ENDIF
- IF Z100
- mov bx,ds ; Set up pointer to config info
- mov es,bx ; . . .
- mov bx,offset auxcnf ; . . .
- mov ah,chr_control ; Function is control
- mov al,chr_cfsu ; Subfunction is set new config
- call bios_auxfunc ; Set the configuration
- ENDIF
- -2848
- IF IBMPC
- -2854
- ENDIF
- -2872
- IF Z100
- mov dx,offset b04st
- cmp baud,B00455
- jz stat9a
- mov dx,offset b05st
- cmp baud,B0050
- jz stat9a
- mov dx,offset b07st
- cmp baud,b0075
- jz stat9a
- mov dx,offset b11st
- cmp baud,B0110
- jz stat9a
- mov dx,offset b13st
- cmp baud,B01345
- jz stat9a
- mov dx,offset b15st
- cmp baud,B0150
- jz stat9a
- mov dx,offset b06st
- cmp baud,B0600
- jne stat9b
- stat9a: jmp stat9
- stat9b: mov dx,offset b20st
- cmp baud,B2000
- jz stat9
- mov dx,offset b24st
- cmp baud,B2400
- jz stat9
- mov dx,offset b96st
- cmp baud,B9600
- jz stat9
- mov dx,offset b19st
- cmp baud,B19200
- jz stat9
- mov dx,offset b38st
- cmp baud,B38400
- jz stat9
- ENDIF
- -3501
- IF IBMPC
- -3502: mov ax,0920H ; Write spaces.
- -3505
- ENDIF
- -3617
- IF IBMPC
- -3622
- ENDIF
- IF Z100
- mov ah,prstr ; Get the function code
- mov dx,offset clrscr ; Want to clear the screen
- int dos ; Do it
- ENDIF
- -3628
- IF IBMPC
- -3632
- ENDIF
- IF Z100
- mov ah,prstr ; Function is print string
- mov dx,offset homcur ; Home cursor
- int dos ; do it
- ENDIF
- -3633: ret